import java.util.Scanner;

public class test {

    public static void main(String[] args) {
        
        int m=1;
        System.out.println("请给地图地名给予上限");
        Scanner st=new Scanner(System.in);
        int x=st.nextInt();
        Graph graph=new Graph(x);
        while(!(m<=0||m>9)){
            System.out.println("请选择要进行的操作");
            System.out.println("序号1:进行加地点操作");
            System.out.println("序号2:进行加路线操作");
            System.out.println("序号3:进行改路线信息操作操作");
            System.out.println("序号4:进行改景点信息操作");
            System.out.println("序号5:进行查找地点景点操作");
            System.out.println("序号6:进行删地点操作");
            System.out.println("序号7:进行删路线操作");
            System.out.println("序号8:进行查找两地最短路径路线操作");
            System.out.println("序号9:进行查找两点最短时间路线操作");
            System.out.println("输入其他数字退出程序");
            Scanner st0=new Scanner(System.in);
            m=st0.nextInt();
            switch (m) {
                case 1:
                System.out.println("正在进行加地点操作");
                    System.out.println("请输入该地点地名");
                    Scanner st1=new Scanner(System.in);
                    String dm=st1.nextLine();
                    System.out.println("请输入该地方景点");
                    Scanner st2=new Scanner(System.in);
                    String jd=st2.nextLine();
                    graph.insertVex(dm, jd);
                    break;
                case 2:
                System.out.println("正在进行加路线操作");
                    System.out.println("请输入第一个地点的编号");
                    Scanner st3=new Scanner(System.in);
                    int dmbh1=st3.nextInt();
                    System.out.println("请输入第二个地方的编号");
                    Scanner st4=new Scanner(System.in);
                    int dmbh2=st4.nextInt();
                    System.out.println("请输入两地距离");
                    Scanner st5=new Scanner(System.in);
                    int jl=st5.nextInt();
                    System.out.println("请输入两地到达时间");
                    Scanner st6=new Scanner(System.in);
                    int sj=st6.nextInt();
                    System.out.println("请输入两地所走的路线名字");
                    String lx;
                    Scanner st7=new Scanner(System.in);
                    lx=st7.nextLine();
                    graph.insertEdge(dmbh1, dmbh2, jl, sj, lx);
                    break;
                case 3:
                System.out.println("正在进行修改路线操作");
                     System.out.println("请输入第一个地点的编号");
                    Scanner s3=new Scanner(System.in);
                    int mbh1=s3.nextInt();
                    System.out.println("请输入第二个地方的编号");
                    Scanner s4=new Scanner(System.in);
                    int mbh2=s4.nextInt();
                    System.out.println("请输入两地距离");
                    Scanner s5=new Scanner(System.in);
                    int l=s5.nextInt();
                    System.out.println("请输入两地到达时间");
                    Scanner s6=new Scanner(System.in);
                    int j=s6.nextInt();
                    System.out.println("请输入两地所走的路线名字");
                    Scanner t7=new Scanner(System.in);
                    String lxname=t7.nextLine();
                    graph.upsetvalue(mbh1, mbh2, l, j, lxname);
                    break;
                case 4:
                System.out.println("地点名字");
                    Scanner dd1=new Scanner(System.in);
                    String dd=dd1.nextLine();
                    System.out.println("景点名字");
                    Scanner view1=new Scanner(System.in);
                    String view=view1.nextLine();
                     graph.upsetview(dd, view);
                    break;
                case 5:
                     System.out.println("进行查找的地点景点名字");
                     Scanner scd=new Scanner(System.in);
                    String scdm3=scd.next();
                    graph.showv(scdm3);
                    break;
                case 6:
                    System.out.println("请输入该地点的编号");
                    Scanner scd0=new Scanner(System.in);
                    int scdm=scd0.nextInt();
                    graph.deleteVex(scdm);
                        break;
                case 7:
                    System.out.println("请输入第一个地点的编号");
                    Scanner sc0=new Scanner(System.in);
                    int scdm1=sc0.nextInt();
                    System.out.println("请输入第二个地方的编号");
                    Scanner sc1=new Scanner(System.in);
                    int scdm2=sc1.nextInt();
                    graph.deleteEdge(scdm1, scdm2);
                    break;
                case 8:
                    System.out.println("请输入第一个地点的编号");
                    Scanner sc01=new Scanner(System.in);
                    int scdm11=sc01.nextInt();
                    System.out.println("请输入第二个地方的编号");
                    Scanner sc21=new Scanner(System.in);
                    int scdm21=sc21.nextInt();
                    graph.Floydjl(scdm11, scdm21);
                    break;
                case 9:
                    System.out.println("请输入第一个地点的编号");
                    Scanner sc03=new Scanner(System.in);
                    int scdm14=sc03.nextInt();
                    System.out.println("请输入第二个地方的编号");
                    Scanner sc14=new Scanner(System.in);
                    int scdm24=sc14.nextInt();
                    graph.Floydsj(scdm14, scdm24);
                    break;
            default:
                break;
        }
        graph.showjljz();
    }
        // Graph graph=new Graph(10);
        // graph.insertVex("武汉", "黄鹤楼");
        // graph.insertVex("福建", "鼓浪屿");
        // graph.insertVex("咸宁", "桂花");
        // graph.insertVex("麻城", "杜鹃山");
        // graph.insertVex("黄梅", "黄梅戏");
        // graph.insertVex("荆州", "关公像");
        // graph.insertEdge(0, 1, 100, 5,"泽承大道");
        // graph.insertEdge(0, 3, 5800, 10,"欢乐大道");
        // graph.insertEdge(0, 4, 100, 4,"孙丹大道");
        // graph.insertEdge(1, 2, 152, 3,"道恩大道");
        // graph.insertEdge(1, 4, 500, 7,"物联大道");
        // graph.insertEdge(2, 3, 250, 6,"少波大道");
        // graph.insertEdge(3, 4, 100, 5,"新宇大道");
        // graph.insertEdge(4, 5, 2400, 4,"鹤翔大道");
        // System.out.println();
        // graph.showv("福建");
        // graph.showjdxx();
        // graph.upsetview("福建", "公道嗯");//改点已完成
        // graph.showv("福建");
        // System.out.println(graph.upsetvalue(0,1,2,10, "泽承大道")); //修改边已完成；
        // graph.deleteVex(0);//删点已经完成
        // graph.deleteEdge(0,1 );//删边已完成
        // graph.Floydjl();
        // graph.Floydsj();//最少时间完成
        // // System.out.println(graph.getEdge(0, 1));//得到边完成
        // graph.shownamejz();//输出名字矩阵
        // System.out.println();
        // graph.showtimejz();//输出时间矩阵
        // System.out.println();
        graph.showjljz();//输出距离矩阵
    }
}